package com.acxy.ants.core.kit;

import com.acxy.ants.core.exception.TipException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author MrShun
 * @version 1.0
 * @Date 2017-06-12
 */
public class LogKit {

    private static final Logger logger = LoggerFactory.getLogger(LogKit.class);

    public static void info(Class cls, String format, Object... arguments){
        if(cls == null)
            logger.info(format, arguments);
        else
            LoggerFactory.getLogger(cls).info(format, arguments);
    }

    public static void info(String format, Object... arguments){
        info(null, format, arguments);
    }

    public static void debug(Class cls, String format, Object... arguments){
        if(cls == null)
            logger.debug(format, arguments);
        else
            LoggerFactory.getLogger(cls).debug(format, arguments);
    }

    public static void debug(String format, Object... arguments){
        debug(null, format, arguments);
    }

    public static void error(Class cls, String format, Object... arguments){
        if(cls == null)
            logger.error(format, arguments);
        else
            LoggerFactory.getLogger(TipException.class).error(format, arguments);
    }

    public static void error(String format, Object... arguments){
        error(null, format, arguments);
    }


    public static void warn(Class cls, String format, Object... arguments){
        if(cls == null)
            logger.warn(format, arguments);
        else
            LoggerFactory.getLogger(TipException.class).warn(format, arguments);
    }

    public static void warn(String format, Object... arguments){
        warn(null, format, arguments);
    }
}
